﻿using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Ooaavee.Scripting;
using Ooaavee.TestTools;

namespace UnitTests.Ooaavee.TestTools
{
    /// <summary>
    /// Tests ScriptingContext class.
    /// </summary>
    [TestClass]
    public class ScriptingContextTest : TestBase
    {
        /// <summary>
        /// Tests CreateDefault method.
        /// </summary>
        [TestMethod]
        public void CreateDefaultTest()
        {
            ScriptingContext context = ScriptingContext.CreateDefault();

            Assert.IsNotNull(context, "context");
            Assert.AreEqual(Language.CSharp, context.Language, "Language");
            Assert.AreEqual(Path.GetTempPath(), context.WorkingDirectory.FullName, "WorkingDirectory");
            Assert.AreNotEqual(0, context.References.Count, "References.Count");
        }

        /// <summary>
        /// Tests Default property.
        /// </summary>
        [TestMethod]
        public void DefaultTest()
        {
            Assert.IsNotNull(ScriptingContext.Default, "context");
            Assert.AreEqual(ScriptingContext.Default, ScriptingContext.Default, "Should be a singleton.");
        }
    }
}
